<%-- 
    Document   : ajouterVehicule
    Created on : 11 juin 2014, 18:40:57
    Author     : David
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%--<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>--%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />

        <script src="js/functions.js" type="text/javascript"></script>
        <%--<sx:head />--%>
        <sj:head />
        <s:head/>
    </head>
    <body>


        <a href="#" class="nav-btn">HOMEPAGE<span></span></a>

        <ul id="menu">
            <li class="active">

                <a href="#">home</a>

            </li>
            <li>

                <a href="#">Mon véhicule</a>
                <ul>
                    <li> <a href="#">Propriétés</a></li>


                    <li><a href="#">Entretiens</a></li>
                </ul>

            </li>
            <li>
                <a href="#">Planfier</a>
                <ul>
                    <li> <a href="#">Un entretien</a></li>
                    <li><a href="#">Un contrôle technique</a></li>
                </ul>
            </li>
        </ul>

        <script type="text/javascript">
        $(document).ready(function() {
            $('#listMarque').change(function(event) {
                var idMarque = $("select#listMarque").val();
                $.getJSON('getJsonModele', {
                  marque : idMarque
                }, function(jsonResponse) {
                  var select = $('#listeModele');
                  select.find('option').remove();
                  $.each(jsonResponse.listModele, function(key, value) {
                    $('<option>').val(value.id).text(value.libelle).appendTo(select);
                  });
                });
                });
          });                                
        </script>
        
        <s:form action="ajouterVehicule">
            <s:select  id="listMarque" list="listMarque"  key="saisie.vehicule.marque" listKey="id" listValue="libelle" name="vehicule.marque.id" >
            </s:select>
            
            <s:select id="listeModele" list="listModele"  key="saisie.vehicule.modele" listKey="id" listValue="libelle" name="vehicule.modele.id" >
            </s:select>    
           
            <%--<sx:datetimepicker  displayFormat="dd-MM-yyyy" name="date" key="saisie.vehicule.miseEnCirculation"/>--%>
            <s:textfield key="saisie.vehicule.miseEnCirculation" name="date"/>
            <s:select list="list"  key="saisie.vehicule.type" listKey="id" listValue="libelle" name="vehicule.typeVehicule.id">

            </s:select>
            <s:textfield key="saisie.vehicule.immatriculation" name="vehicule.immatriculation"/>

            <s:textfield key="saisie.vehicule.numSerie" name="vehicule.numSerie"/>
            <s:textfield key="saisie.vehicule.kms" name="vehicule.kms"/>

            <s:submit key="saisie.vehicule.ajouter" action="AjouterVehicule" cssClass="bfsbutton"/>
        </s:form>
    </body>
</html>